package com.shang.bean;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 * @ClassName MyBeanPro
 * @Description 后置处理器
 * @Author Larry
 * @Date 2021/5/20 10:13
 * @Version 1.0
 */
public class MyBeanPro implements BeanPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {

        System.out.println("初始化之前执行。。。。。。。。。。。。。。。");

        return BeanPostProcessor.super.postProcessBeforeInitialization(bean, beanName);
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {

        System.out.println("初始化之后执行。。。。。。。。。。。。。。。");

        return BeanPostProcessor.super.postProcessAfterInitialization(bean, beanName);
    }
}
